﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LTJ.FrameWork;
using LTJ.Common;
using LTJ.Entity;

namespace uswinweb.admin
{
    public partial class usergroup_add : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SASRequest.IsPost())
            {
                
                if (SASRequest.GetFormString("ugNametxt")!="")
                {
                    AddUserGroup();   
                }
            }
        }
        protected void AddUserGroup()
        {
            UserGroupInfo ugroupInfo = new UserGroupInfo();
            ugroupInfo.name = SASRequest.GetFormString("ugNametxt");
            ugroupInfo.sort = 1;
            ugroupInfo.status = 1;
            ugroupInfo.backup = "";
            int msg = UserGroup.CreateUserGroup(ugroupInfo);
            if (msg > 0)
            {
                base.RegisterStartupScript("PAGE", "parent.document.getElementById('reclick').click();parent.Lightview.hide();");
            }
            else
            {
                if (msg == -1)
                {
                    base.RegisterStartupScript("PAGETEMPLATE", "此用户组已存在！");
                }
                base.RegisterStartupScript("PAGETEMPLATE", "用户组添加失败!");
            }

        }
    }
}